<?php
namespace printPictures;
require_once 'model/Database.php';

class printPictures{
	
	private static $UsernameSession = "UsernameSession";
	private $comment;
	private $con;
	private $db;
	
	public function __construct(){
		$this->db = new \database\Database();
		$this->con = $this->db->getDatabase();
	}
	public function getFiles(){
		$files = glob("model/uploads/*.*");
		
		usort($files, function($a, $b){
			return filemtime($b) - filemtime($a);
		});
		
		return $files;
	}
		
	public function getDbResults(){
		$result = mysqli_query($this->con,"SELECT * FROM comments");
		
		return $result;
	}
	public function getUsername(){
		return $_SESSION[self::$UsernameSession];
	}	
}
